package com.sinry.common.utils;

import org.springframework.beans.BeanUtils;

public class BeanCopy extends BeanUtils {
    public static <T> T to(Object source, Class<T> targetClazz) {
        try {
            if (targetClazz != null) {
                T targetInstance = targetClazz.newInstance();
                copyProperties(source, targetInstance);
                return targetInstance;
            }
        } catch (IllegalAccessException | InstantiationException ignored) {
        }
        return null;
    }

//    public static <T> T to(Object source, T Clazz) throws BeansException {
//        copyProperties(source, target);
//    }

}
